package com.originskyseed.platform.job.jobhandler.recharge;

import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.stereotype.Component;

import com.originskyseed.platform.core.job.biz.model.ReturnT;
import com.originskyseed.platform.core.job.handler.IJobHandler;
import com.originskyseed.platform.core.job.handler.annotation.JobHandler;
import com.originskyseed.platform.core.job.log.JobLogger;
import com.originskyseed.platform.user.service.IPlayerRelateRechargeService;
import com.originskyseed.platform.user.service.IUserInfoService;

/**
 * 统计用户累充功能
 * 
 * @Author: twh @date: 2021/7/28
 */

@Component
@JobHandler(value = "rechargeCountHandler")
public class RechargeCountHandler extends IJobHandler {

	@DubboReference
	private IUserInfoService userInfoService;

	@DubboReference
	private IPlayerRelateRechargeService playerRelateRechargeService;

	@Override
	public ReturnT<String> execute(String tenantCode) throws Exception {
		try {
			this.playerRelateRechargeService.insertUserCumulativeRechargeCount(tenantCode);
		} catch (Exception e) {
			JobLogger.log("统计用户累充功能：" + e.getMessage());
			return FAIL;
		}
		return SUCCESS;
	}
}
